﻿//	C(n,m) 从n中选中m个的组合（n>=m）
//var aa = C(n,m);
function C(n,m){
    if(n<m){
        return res = 0;
    }else{
        var a = 1;
        for (var i = n;i >= 1 ;i--){
            a*=i;
        }

        var b = 1;
        for (var i = (n-m);i >= 1 ;i--){
            b*=i;
        }

        var c = 1;
        for (var i = m;i >= 1 ;i--){
            c*=i;
        }
//		console.log(a+"/"+b+"/"+c);
        return res = a/(b*c);
    }

}

//wenxintishi
wxts();
function wxts(){
    $(".layermend,.layermbtn").click(function(){
        //$(this).parents(".layermbox").hide();
        $(".layermbox").hide();

    })
}
//wenxintishi end
//小数的加法
function accAdd(arg1,arg2){
    var r1,r2,m;
    try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
    try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
    m=Math.pow(10,Math.max(r1,r2));
    return (arg1*m+arg2*m)/m;
}

//生成随机数

function sj_zhu(x,y,n){
    //x上限 y下限 n生成的数量

    var zhi ="";
    for(var i = 1;i<=n;i++){
        var val = parseInt(Math.random() * (x - y + 1) + y);
        var len =val.toString().length;
        if(len == 1 ){
            zhi += "0"+val+" ";
        }else{
            zhi += val+" ";
        }
    }
    zhi = zhi.substring(0,zhi.toString().length-1);
    return zhi;
}
function sj_zhu2(x,y,n){
    //x上限 y下限 n生成的数量,不把单号变成两位数

    var zhi ="";
    for(var i = 1;i<=n;i++){
        var val = parseInt(Math.random() * (x - y + 1) + y);
        var len =val.toString().length;
        zhi += val+" ";
    }
    zhi = zhi.substring(0,zhi.toString().length-1);
    return zhi;
}

//PK 10
//注数
//猜前五-复式
function qian5fs(obj1,obj2,obj3,obj4,obj5){
    var res = 0;
    obj1.each(function(){
        var a1 = $(this).text().replace(/\s/g,"");
        obj2.each(function(){
            var a2 = $(this).text().replace(/\s/g,"");
            obj3.each(function(){
                var a3 = $(this).text().replace(/\s/g,"");
                obj4.each(function(){
                    var a4 = $(this).text().replace(/\s/g,"");
                    obj5.each(function(){
                        var a5 = $(this).text().replace(/\s/g,"");
                        if(a1 !== a2 && a1 !== a3 && a1 !== a4 && a1 !== a5 && a2 !== a3 && a2 !== a4 && a2 !== a5 && a3 !== a4 && a3 !== a5 && a4 !== a5){
                            res++;
                        }
                    })
                })
            })
        })
    });
    return res;
}
//猜前四-复式
function qian4fs(obj1,obj2,obj3,obj4){
    var res = 0;
    obj1.each(function(){
        var a1 = $(this).text().replace(/\s/g,"");
        obj2.each(function(){
            var a2 = $(this).text().replace(/\s/g,"");
            obj3.each(function(){
                var a3 = $(this).text().replace(/\s/g,"");
                obj4.each(function(){
                    var a4 = $(this).text().replace(/\s/g,"");
                    if(a1 !== a2 && a1 !== a3 && a1 !== a4 && a2 !== a3 && a2 !== a4 && a3 !== a4){
                        res++;
                    }
                })
            })
        })
    });
    return res;
}
//猜前三-复式
function qian3fs(obj1,obj2,obj3){
    var res = 0;
    obj1.each(function(){
        var a1 = $(this).text().replace(/\s/g,"");
        obj2.each(function(){
            var a2 = $(this).text().replace(/\s/g,"");
            obj3.each(function(){
                var a3 = $(this).text().replace(/\s/g,"");
                if(a1 !== a2 && a1 !== a3 && a2 !== a3){
                    res++;
                }
            })
        })
    });
    return res;
}
//猜前二-复式
function qian2fs(obj1,obj2){
    var res = 0;
    obj1.each(function(){
        var a1 = $(this).text().replace(/\s/g,"");
        obj2.each(function(){
            var a2 = $(this).text().replace(/\s/g,"");
            if(a1 !== a2){
                res++;
            }
        })
    });
    return res;
}

//机选生成注
//解释：从【y-x】中【任选n个】【不重复】的数，以【m】格式输出
function pk10_jix(x,y,n,m){

    //x 最大值
    //y 最小值
    //n 猜前几 （5,4,3,2）
    //m 复式，单式（0：复式，1：单式）
    var res = "";

    var randoms=[];
    while (true)
    {
        var isExists = false;
        // 获取一个10–100范围的数
        var random = sj_zhu(x,y,1);
        if(random.toString().length == 1){
            random = "0"+random;
        }
        // 判断当前随机数是否已经存在
        for (var i = 0; i < randoms.length; i++) {
            if (random === randoms[i]) {
                isExists = true;
                break;
            }
        }
        // 如果不存在，则添加进去
        if (!isExists)
            randoms.push(random);
        // 如果有10位随机数了，就跳出
        if (randoms.length === n)
            break;
    }


    if(m == 0){
        //复式
        randoms = randoms.join(",");
    }
    if(m == 1){
        //单式
        randoms = randoms.join(" ");
    }
    return randoms;

}

function ssc_jix(x,y,n,m){
    //不把单数变双数

    //x 最大值
    //y 最小值
    //n 猜前几 （5,4,3,2）
    //m 复式，单式（0：复式，1：单式）
    var res = "";

    var randoms=[];
    while (true)
    {
        var isExists = false;
        // 获取一个10–100范围的数
        var random = sj_zhu2(x,y,1);
        // 判断当前随机数是否已经存在
        for (var i = 0; i < randoms.length; i++) {
            if (random === randoms[i]) {
                isExists = true;
                break;
            }
        }
        // 如果不存在，则添加进去
        if (!isExists)
            randoms.push(random);
        // 如果有10位随机数了，就跳出
        if (randoms.length === n)
            break;
    }


    if(m == 0){
        //复式
        randoms = randoms.join(",");
    }
    if(m == 1){
        //单式
        randoms = randoms.join(" ");
    }
    return randoms;

}

//手动输入验证
//1.返回注数
function pk10_sryz2(arrs,new_arr,reg2){
    //手动输入号码js
    var reg = reg2;
    var nr = 0;
    $.each(arrs,function(i,v){
        var istrue = reg.test(v);
        if(istrue){
            //如果正则正确，则判断一组中是否含有重复的数字
            var arrs2 = v.split(" ");
            var new_arr2=[];
            var isa2 = 0;

            $.each(arrs2,function(i1,v1){
                $.each(new_arr2,function(i2,v2){
                    if(v1 == v2){
                        isa2 = 1;
                        return ;
                    }
                });
                if(isa2 == 0){
                    new_arr2.push(v1);
                }
            });

            //不含重复数字,格式正确，判断重复注数
            if(isa2 == 0){
                //重复注数判断
                var nn = 0;
                $.each(new_arr,function(io,vo){
                    if(v == vo){
                        //有重复注数
                        nn = 1;
                    }
                });
                if(nn == 0){
                    new_arr.push(v);
                    nr++;
                }
            }

        }
    });
    return nr;
}
//2.返回正确的选注
function pk10_sryz3(arrs,reg3){
    //点击删除错误项js
    var order_num = "";
    var new_arr =[];
    var reg = reg3;
    var is61 = 0;
    $.each(arrs,function(i,v){
        //去除重复的注
        var isa = 0;
        $.each(new_arr,function(io,vo){
            if(v == vo){
                isa = 1;
                is61 = 1;
                return ;
            }
        });
        if(isa == 0){
            new_arr.push(v);
        }
    });

    $.each(new_arr,function(ii,vi){
        var istrue = reg.test(vi);
        if(istrue){
            //去除单注中的有重复数字的注
            var arrs2 = vi.split(" ");
            var new_arr2=[];
            var isa2 = 0;

            $.each(arrs2,function(i1,v1){
                $.each(new_arr2,function(i2,v2){
                    if(v1 == v2){
                        isa2 = 1;
                        is61 = 1;
                        return ;
                    }
                });
                if(isa2 == 0){
                    new_arr2.push(v1);
                }
            });
            if(isa2 == 0){
                order_num += vi+",";
            }

        }else{
            is61 = 1;
        }
    });
    if(is61 == 0){
        $("#layermbox61").show();
    }
    return order_num;


}


//11X5 JS
//前三直选复式 生成注数
function syx5_0(obj1,obj2,obj3){

    var zres = 0;
    obj1.each(function(){
        var a0 = $(this).text().replace(/\s/g,"");
        obj2.each(function(){
            var b0 = $(this).text().replace(/\s/g,"");

            if(a0 !== b0){
                obj3.each(function(){
                    var c0 = $(this).text().replace(/\s/g,"");
                    if(b0 !== c0 && a0 !== c0){
                        zres++;
                    }
                });
            }
        });
    });
    return  zres;
}
//前二直选复式
function syx5_1(obj1,obj2){

    var zres = 0;
    obj1.each(function(){
        var a0 = $(this).text().replace(/\s/g,"");
        obj2.each(function(){
            var b0 = $(this).text().replace(/\s/g,"");

            if(a0 !== b0){
                zres++;
            }
        });
    });
    return  zres;
}

//胆拖机选生成注
//返回组成的胆拖选注
function syx5_ji_dantuo(y,x,n){
    //n 注的总长度
    //y 是随机数的最大值
    //x 是随机数的最大值

    var sd = sj_zhu(2,1,1);//胆拖 随机生成（1,2）判断一个数字的位置
    var sd_num = pk10_jix(y,x,n,1);//生成包括胆拖在内的所有数字，以‘ ’分割
    if(sd == 1){
        //单数在最前
        var num1 = sd_num.substring(0,2);//截取前两个数字作为胆拖
        var num2 = sd_num.substring(3);//截取3到最后个数字作为拖码

    }
    if(sd == 2){
        //单数在最后
        var num1 = sd_num.substring(0,sd_num.length-3);//截取倒数第三个数字之前的所有数字作为胆拖
        var num2 = sd_num.substring(sd_num.length-2);//截取最后两个数字作为拖码
    }
    //合并胆拖
    //返回组成的胆拖选注
    return num1+","+num2;
}

//ssc 组选60的算法
//obj1 二重号位的选中的a的组合
//obj2 单号位的选中的a的组合
//例如
//var naActives = $(".na span.active");
//var nbActives = $(".nb span.active");
//
//var aa = zu60(naActives,nbActives);
//alert(aa);
function zu60(obj1,obj2){
    var zres = 0;
    var naLen = obj1.length;
    var nbLen = obj2.length;
    obj1.each(function(){
        var k =  2;
        var a0 = $(this).text().replace(/\s/g,"");
        if(naLen >=1){
            if(nbLen>=3){
                obj2.each(function(){
                    var b0 = $(this).text().replace(/\s/g,"");
                    if(a0 == b0){
                        //有一个相等的值，k 就变为1
                        k = 1;
                    }
                });

                if( k == 1){
                    //B值 中 有 与 A值 相等的值,则使用第一种算法
                    if(nbLen >= 4){
                        zres += C((nbLen-1),3);
                    }
                }else{
                    zres += C(nbLen,3);
                }
            }
        }
    });
    return  zres;
}
//ssc 组选30的算法
function zu30(obj1,obj2){
    var zres = 0;
    var naLen = obj1.length;
    var nbLen = obj2.length;


    obj2.each(function(){
        var k =  2;
        var a0 = $(this).text().replace(/\s/g,"");

        if(naLen >=2){

            obj1.each(function(){
                var b0 = $(this).text().replace(/\s/g,"");
                if(a0 == b0){
                    //有一个相等的值，k 就变为1
                    k = 1;
                }
            });

            if( k == 1){
                //B值 中 有 与 A值 相等的值,则使用第一种算法
                if(naLen >= 3){
                    zres += C((naLen-1),2);
                }
            }else{
                zres += C(naLen,2);
            }
        }
    });
    return  zres;
}
//组选20
function zu20(obj1,obj2){
    var zres = 0;
    var naLen = obj1.length;
    var nbLen = obj2.length;


    obj1.each(function(){
        var k =  2;
        var a0 = $(this).text().replace(/\s/g,"");

        if(nbLen >=2){

            obj2.each(function(){
                var b0 = $(this).text().replace(/\s/g,"");
                if(a0 == b0){
                    //有一个相等的值，k 就变为1
                    k = 1;
                }
            });

            if( k == 1){
                //B值 中 有 与 A值 相等的值,则使用第一种算法
                if(nbLen >= 3){
                    zres += C((nbLen-1),2);
                }
            }else{
                zres += C(nbLen,2);
            }
        }
    });
    return  zres;
}
//组选10
function zu10(obj1,obj2){
    var zres = 0;
    var naLen = obj1.length;
    var nbLen = obj2.length;


    obj1.each(function(){
        var k =  2;
        var a0 = $(this).text().replace(/\s/g,"");

        if(nbLen >=1){

            obj2.each(function(){
                var b0 = $(this).text().replace(/\s/g,"");
                if(a0 == b0){
                    //有一个相等的值，k 就变为1
                    k = 1;
                }
            });

            if( k == 1){
                //B值 中 有 与 A值 相等的值,则使用第一种算法
                if(nbLen >= 2){
                    zres += C((nbLen-1),1);
                }
            }else{
                zres += C(nbLen,1);
            }
        }
    });
    return  zres;
}

//直选和值1三位算法
function zhi1(obj1){
    var n = 0;
    var A = 0;
    obj1.each(function(){
        var M = $(this).text().replace(/\s/g,"");
        if(M>9){
            A = 9;
        }else{
            A = M;
        }
        //个位：
        for (var i = 0 ;i <= A ; i++){
            //十位：
            for (var j = 0 ;j <= A ; j++){
                //百位：
                for (var k = 0 ;k <= A ; k++){
                    var he = i+j+k;
                    if(he == M){
                        n++;
                    }
                }
            }
        }
    });
    return n;
}
//直选和值2两位算法
function zhi2(obj1){
    var n = 0;
    var A = 0;
    obj1.each(function(){
        var M = $(this).text().replace(/\s/g,"");
        if(M>9){
            A = 9;
        }else{
            A = M;
        }
        //个位：
        for (var i = 0 ;i <= A ; i++){
            //十位：
            for (var j = 0 ;j <= A ; j++){
                var he = i+j;
                if(he == M){
                    n++;
                }
            }
        }
    });
    return n;
}

//组选和值2两位算法
function zhi3(obj1){
    var n = 0;
    var A = 0;
    obj1.each(function(){
        var M = $(this).text().replace(/\s/g,"");
        if(M>9){
            A = 9;
        }else{
            A = M;
        }
        //个位：
        for (var i = 0 ;i <= A ; i++){
            //十位：
            for (var j = 0 ;j <= A ; j++){
                var he = i+j;
                if(i==j){

                }else{
                    if(he == M){
                        n++;
                    }
                }

            }
        }
    });
    return n;
}

//SSC 输入输入验证js
function ssc_sryz1(arrs,regs,num){
    //点击确认选号按钮
    var str3 ="";
    var new_arr =[];
    var new_arr4 = [];
    var new_arr5 = [];
    var reg = regs;
    $.each(arrs,function(i,v){
        //去除重复的注
        var isa = 0;
        $.each(new_arr,function(io,vo){
            if(v == vo){
                isa = 1;
                return ;
            }
        });
        if(isa == 0){
            new_arr.push(v);
        }
    });

    $.each(new_arr,function(ii,vi){
        var istrue = reg.test(vi);
        if(istrue){
            if(num == 1){
                //组六单选
                //去除注中有重复数字的注
                var arrs2 = vi.split("");
                var new_arr2=[];
                var isa2 = 0;

                $.each(arrs2,function(i1,v1){
                    $.each(new_arr2,function(i2,v2){
                        if(v1 == v2){
                            isa2 = 1;
                            return ;
                        }
                    });
                    if(isa2 == 0){
                        new_arr2.push(v1);
                    }
                });

                //把符合格式的三位数，按从小到大的顺序排列
                if(isa2 == 0){
                    var k = 0;
                    var nstr = "";
                    for(var j = 0 ; j< vi.length ; j++){
                        if(k <=  vi[j]){
                            nstr += vi[j];
                            k = vi[j]
                        }else{
                            nstr = vi[j] + nstr;
                        }
                    }
                    new_arr4.push(nstr);
                }
            }
            if(num == 2){
                //混合组选
                //把合格的按照顺序排列
                var reg1 = /^([0-9])\1{2}$/;
                var ist1 = reg1.test(vi);
                if(!ist1){
                    var k = 0;
                    var nstr = "";
                    for(var j = 0 ; j< vi.length ; j++){
                        if(k <=  vi[j]){
                            nstr += vi[j];
                            k = vi[j]
                        }else{
                            nstr = vi[j] + nstr;
                        }
                    }
                    $(".box3").append(nstr+",");
                    new_arr4.push(nstr);
                }

            }
            if(num == 3){
                //组三单选
                var reg1 = /^([0-9])\1{2}$/;
                var reg2 = /^([0-9])\1[0-9]$/;
                var reg3 = /^([0-9])[0-9]\1$/;
                var reg4 = /^[0-9]([0-9])\1$/;
                var ist1 = reg1.test(vi);
                if(!ist1){
                    var ist2 = reg2.test(vi);
                    var ist3 = reg3.test(vi);
                    var ist4 = reg4.test(vi);
                    if(ist2||ist3||ist4){
                        var k = 0;
                        var nstr = "";
                        for(var j = 0 ; j< vi.length ; j++){
                            if(k <=  vi[j]){
                                nstr += vi[j];
                                k = vi[j]
                            }else{
                                nstr = vi[j] + nstr;
                            }
                        }
                        $(".box3").append(nstr+",");
                        new_arr4.push(nstr);

                    }

                }
            }


        }
    });
    //合并重复的
    $.each(new_arr4,function(ik,vk){
        var ic = 0;
        $.each(new_arr5,function(i0,v0){
            if(vk == v0){
                ic = 1;
            }
        });
        if(ic == 0){
            new_arr5.push(vk);
        }
    });
    //console.log(new_arr5);
    $.each(new_arr5,function(ia,va){
        str3 += va+",";
    });
    return str3;
}

function ssc_sryz2(arrs,new_arr,reg2,num){
    //手动输入号码js
    var reg = reg2;
    var nr = 0;
    var new_arr4 = [];
    var new_arr5 = [];
    $.each(arrs,function(i,v){
        var istrue = reg.test(v);
        if(istrue){
            //组六单选
            if(num == 1){
                //如果正则正确，则判断一组中是否含有重复的数字
                var arrs2 = v.split("");
                var new_arr2=[];
                var isa2 = 0;

                $.each(arrs2,function(i1,v1){
                    $.each(new_arr2,function(i2,v2){
                        if(v1 == v2){
                            isa2 = 1;
                            return ;
                        }
                    });
                    if(isa2 == 0){
                        new_arr2.push(v1);
                    }
                });

                //把符合格式的三位数，按从小到大的顺序排列
                if(isa2 == 0){
                    var k = 0;
                    var nstr = "";
                    for(var j = 0 ; j< v.length ; j++){
                        if(k <=  v[j]){
                            nstr += v[j];
                            k = v[j]
                        }else{
                            nstr = v[j] + nstr;
                        }
                    }
                    new_arr4.push(nstr);
                }
            }
            if(num == 2){
                //混合组选
                //把合格的按照顺序排列
                var reg1 = /^([0-9])\1{2}$/;
                var ist1 = reg1.test(v);
                if(!ist1){
                    var k = 0;
                    var nstr = "";
                    for(var j = 0 ; j< v.length ; j++){
                        if(k <=  v[j]){
                            nstr += v[j];
                            k = v[j]
                        }else{
                            nstr = v[j] + nstr;
                        }
                    }
                    $(".box3").append(nstr+",");
                    new_arr4.push(nstr);
                }

            }
            if(num == 3){
                //组三单选
                var reg1 = /^([0-9])\1{2}$/;
                var reg2 = /^([0-9])\1[0-9]$/;
                var reg3 = /^([0-9])[0-9]\1$/;
                var reg4 = /^[0-9]([0-9])\1$/;
                var ist1 = reg1.test(v);
                if(!ist1){
                    var ist2 = reg2.test(v);
                    var ist3 = reg3.test(v);
                    var ist4 = reg4.test(v);
                    if(ist2||ist3||ist4){
                        var k = 0;
                        var nstr = "";
                        for(var j = 0 ; j< v.length ; j++){
                            if(k <=  v[j]){
                                nstr += v[j];
                                k = v[j]
                            }else{
                                nstr = v[j] + nstr;
                            }
                        }
                        $(".box3").append(nstr+",");
                        new_arr4.push(nstr);

                    }

                }
            }


        }
    });

    //合并
    $.each(new_arr4,function(i,v){
        var ic = 0;
        $.each(new_arr5,function(i0,v0){
            if(v == v0){
                ic = 1;
            }
        });
        if(ic == 0){
            new_arr5.push(v);
        }
    });

    nr = new_arr5.length;
    return nr;
}

function ssc_sryz3(arrs,reg3,num){
    //点击删除错误项js
    var order_num = "";
    var new_arr =[];
    var new_arr4 =[];
    var new_arr5 =[];
    var reg = reg3;
    var is61 = 0;
    $.each(arrs,function(i,v){
        //去除重复的注
        var isa = 0;
        $.each(new_arr,function(io,vo){
            if(v == vo){
                isa = 1;
                is61 = 1;
                return ;
            }
        });
        if(isa == 0){
            new_arr.push(v);
        }
    });

    $.each(new_arr,function(ii,vi){
        var istrue = reg.test(vi);
        if(istrue){

            if(num == 1){
                //组六单选
                //去除单注中的有重复数字的注
                var arrs2 = vi.split("");
                var new_arr2=[];
                var isa2 = 0;

                $.each(arrs2,function(i1,v1){
                    $.each(new_arr2,function(i2,v2){
                        if(v1 == v2){
                            isa2 = 1;
                            is61 = 1;
                            return ;
                        }
                    });
                    if(isa2 == 0){
                        new_arr2.push(v1);
                    }
                });

                //把符合格式的三位数，按从小到大的顺序排列
                if(isa2 == 0){
                    var k = 0;
                    var nstr = "";
                    for(var j = 0 ; j< vi.length ; j++){
                        if(k <=  vi[j]){
                            nstr += vi[j];
                            k = vi[j]
                        }else{
                            nstr = vi[j] + nstr;
                        }
                    }
                    new_arr4.push(nstr);
                }
            }
            if(num == 2){
                //混合组选
                //把合格的按照顺序排列
                var reg1 = /^([0-9])\1{2}$/;
                var ist1 = reg1.test(vi);
                if(!ist1){
                    var k = 0;
                    var nstr = "";
                    for(var j = 0 ; j< vi.length ; j++){
                        if(k <=  vi[j]){
                            nstr += vi[j];
                            k = vi[j]
                        }else{
                            nstr = vi[j] + nstr;
                        }
                    }
                    $(".box3").append(nstr+",");
                    new_arr4.push(nstr);
                }

            }
            if(num == 3){
                //组三单选
                var reg1 = /^([0-9])\1{2}$/;
                var reg2 = /^([0-9])\1[0-9]$/;
                var reg3 = /^([0-9])[0-9]\1$/;
                var reg4 = /^[0-9]([0-9])\1$/;
                var ist1 = reg1.test(vi);
                if(!ist1){
                    var ist2 = reg2.test(vi);
                    var ist3 = reg3.test(vi);
                    var ist4 = reg4.test(vi);
                    if(ist2||ist3||ist4){
                        var k = 0;
                        var nstr = "";
                        for(var j = 0 ; j< vi.length ; j++){
                            if(k <=  vi[j]){
                                nstr += vi[j];
                                k = vi[j]
                            }else{
                                nstr = vi[j] + nstr;
                            }
                        }
                        $(".box3").append(nstr+",");
                        new_arr4.push(nstr);

                    }

                }
            }



        }else{
            is61 = 1;
        }
    });
    if(is61 == 0){
        $("#layermbox61").show();
    }


    //合并
    $.each(new_arr4,function(i,v){
        var ic = 0;
        $.each(new_arr5,function(i0,v0){
            if(v == v0){
                ic = 1;
            }
        });
        if(ic == 0){
            new_arr5.push(v);
        }
    });
    $.each(new_arr5,function(i,v){
        order_num += v+",";
    });
    return order_num;


}

function ssc_sryz4(arrs,reg4){
    //检查格式是否正确js
    var reg = reg4;
    var new_arr =[];
    //格式错误的
    var wr_str = "";
    var iw = 0;
    var ic = 0;
    var isa = 0;

    $.each(arrs,function(i,v){
        //测试格式是否正确
        var istrue = reg.test(v);
        if(!istrue){
            //不正确
            wr_str += v+",";
            iw = 1;
        }else{
            //没有格式错误开始进行注数重复判断
            //重复注数
            var n1 = 0;
            $.each(new_arr,function(io,vo){
                if(v == vo){
                    //有重复注数，+1
                    isa++;
                    ic = 1;
                    n1 = 1;
                }
            });
            if(n1 == 0){
                new_arr.push(v);
            }

        }
    });


    //错误投注组成的字符串
    wr_str = wr_str.substring(0,wr_str.length-1);
    //有格式错误的
    if(iw == 1 && ic == 0 && wr_str !== ""){
        $("#layermbox101 .layermcont").html("以下投注格式不正确：<br>"+wr_str);

        $("#layermbox101").show();
    }else
    //有重复的时候
    if(ic == 1 && iw == 0 && isa !== 0){
        //重复注数：
        $("#layermbox101 .layermcont").html("您有"+isa+"注重复注单");
        $("#layermbox101").show();
    }

    //既有 重复，又有格式错误的时候
    if(ic == iw == 1 && isa !== 0 && wr_str !== ""){
        $("#layermbox101 .layermcont").html("您有"+isa+"注重复注单<br>以下投注格式不正确：<br>"+wr_str);
        $("#layermbox101").show();
    }

    if(ic == 0 && iw == 0){
        $("#layermbox61").show();
    }

}